import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'
class Header extends Component {

  go = (num)=>{
    return ()=>{
      this.props.history.go(num)
    }
  }
  render() {
    console.log('props-header', this.props);
    return (
      <div className="row">
        <div className="col-xs-offset-2 col-xs-8">
          <button onClick={this.go(1)}>前进</button>
          <button onClick={this.go(-1)}>后退</button>
          <div className="page-header"><h2>React Router Demo</h2></div>
        </div>
      </div>
    )
  }
}

export default withRouter(Header)
